<?php
/**
 * User controller for the admin module
 * 
 * @package EICms
 * @subpackage Controllers
 * @author hcderaad
 */
class Admin_UserController extends EICms_Controller_Action {
	
	/**
	 * Indexaction
	 *
	 */
	public function indexAction() {
		$this->view->title = $this->_('users');
		$this->view->adminbar = '<a href="' . EICms_Url::get('index','index',array(),'admin') . '">' . $this->_('back') . '</a>' . PHP_EOL; 
		$this->view->content = '<a href="' . EICms_Url::get('user','add',null,'admin') . '">' . $this->_('add') . '</a>';
		$userModel = new EICms_Model_User();
		$this->view->users = $userModel->fetchList();
	}
	
	public function addAction() {
		$this->view->title = $this->_('user') . ' ' . $this->_('add');
		$this->view->adminbar = '<a href="' . EICms_Url::get('user','index',array(),'admin') . '">' . $this->_('back') . '</a>' . PHP_EOL; 
		$this->view->form = $this->getUserForm();
	}
	
	public function editAction() {
		$this->view->title = $this->_('user') . ' ' . $this->_('edit');
	}
	
	public function saveAction() {
		
	}
	
	protected function getUserForm() {
		$form = new Zend_Dojo_Form();
		$form->addElement('text','username',
						array('label' => $this->_('username'),
								'required' => true));
		$form->addElement('password','password',
						array('label' => $this->_('password'),
								'required' => true));
		$form->addElement('submit','submit',array('label' => $this->_('save')));
		return $form;
	}
}
?>